6/22/2021

Plotly

Classic gapminder

Life expectancy is the size of points

Code is in the next page

Code

gapminder%>%
    group_by(year,continent)%>%
    summarize(across(c(pop,lifeExp,gdpPercap),
                     ~mean(.x,na.rm=TRUE)),
              .groups = "drop")%>%
    plotly::plot_ly(x=~pop,
                    y=~gdpPercap,
                    size=~lifeExp,
                    color=~continent,
                    frame = ~year,
                    type="scatter",
                    mode="markers")